<?php $this->headScript()
->appendFile($this->js('plugins/jquery.blockUI.js'))?>
<style>
.workflow ul {list-style-type: decimal}
#mainTable {width:100%}
#mainTable td{vertical-align: top;}
.listData {width:100%; border-spacing:1px; background: #ccc; text-align:center}
.even {background: #ffe}
.odd {background: #eef}
</style>
<script>
$(function(){
    $("#classSn").change(function(){
    	$("#selectForm").submit();
     });

    $("#actButton").click(function(){
    	  $.blockUI({ message: '<h1><img src="<?php echo $this->BaseUrl()?>/images/loading.gif" /> <?php echo $this->translate("Just a moment..")?>.</h1>' });
    	  $("#act").val(1);
       $("#selectForm").submit();
    });

    $(".listData tbody tr:even").addClass('even');
    $(".listData tbody tr:odd").addClass('odd');
    <?php if ($this->updated):?>
    alert('<?php echo $this->translate("update finished")?>');
    <?php endif?>
});
</script>
<div class="ui-widget">
<form action="" method="post" id="selectForm">
<div  style="margin:5px">
<select name="classSn" id="classSn">
<option value=""><?php echo $this->translate('choose class ..')?></option>
<?php echo $this->classNameOptions($this->Semester['yearSeme'],$this->classSn)?>
</select>
</div>
<table id="mainTable">
<tr>
<td style="width:40%">
<fieldset class="workflow">
    <legend><?php echo $this->translate('workflow')?></legend>
    <?php echo $this->translate('workflow memo')?>
    <?php $i =1;?>
    <div style="float:left">
    <?php foreach ($this->orderItemArr as $row):?>
    <div>
    <h3><?php echo sprintf($this->translate('%d th priority'), $i)?></h3>
    <select name="priority[<?php echo $i?>]">
    <option value=""><?php echo $this->translate('not choose')?></option>
    <?php foreach ($this->orderItemArr as $val):?>
    <option value="<?php echo $val?>" <?php if(isset($this->priority[$i]) and $this->priority[$i] == $val ) echo "selected"?>><?php echo $this->translate($val)?></option>
    <?php endforeach?>
    </select>
    <select name="order[<?php echo $i?>]">
    <option value=""><?php echo $this->translate('not choose')?></option>
    <?php foreach($this->orderRule as $rule):?>
    <option value="<?php echo $rule?>" <?php if(isset($this->order[$i]) and $this->order[$i] == $rule) echo "selected"?> ><?php echo $this->translate($rule)?></option>
    <?php endforeach?>
    </select>
    </div>
    <?php $i++;?>
    <?php endforeach?>
    </div>
    <div style="text-align:right;float:left;margin: 25px 10px">
    <input type="reset" />
    <input type="submit" value="<?php echo $this->translate('begin arrange')?>" />
    </div>
    <div style="clear:both"></div>
</fieldset>
</td>
<td style="width:60%">
<fieldset class="workflow">
    <legend><?php echo $this->translate('student list')?></legend>
    <?php if ($this->data):?>
    <div style="margin-bottom: 5px; border-bottom: #ccc thin dashed; padding:5px">
    <input type="button"  id="actButton"  value="<?php echo $this->translate('start change')?>" />
    </div>
    <table class="listData">
    <thead>
    <tr>
        <th><?php echo $this->translate('new number')?></th>
        <th><?php echo $this->translate('sex')?></th>
        <th><?php echo $this->translate('old number')?></th>
        <th><?php echo $this->translate('student id')?></th>
        <th><?php echo $this->translate('student name')?></th>
        <th><?php echo $this->translate('birthday')?></th>
    </tr>
    </thead>
    <tbody>
    <?php foreach($this->data as $i=>$row): ?>
    <tr>
    <td><input type="text" name=newNumber[<?php echo $row['sn']?>]" size="3" value="<?php echo $i+1?>" /></td>
    <td><?php echo $this->translate('sex-'.$row['sex'])?></td>
    <td><?php echo $row['number']?></td>
    <td><?php echo $row['student_id']?></td>
    <td><?php echo $row['name']?></td>
    <td><?php echo $row['birthday']?></td>
    </tr>
    <?php endforeach?>
    </tbody>
    </table>
<?php endif?>
</fieldset>
</td>
</tr>
</table>
<input type="hidden"  id="act" name="act" />
</form>
</div>